package com.baiyun.service.impl;

import com.baiyun.entity.Tea;
import com.baiyun.mapper.TeaMapper;
import com.baiyun.service.TeaService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class TeaServiceImpl implements TeaService {

    private final TeaMapper teaMapper;
    /**
     * @param
     * @return
     */
    @Override
    public List<Tea> selectAllTeas() {
        return teaMapper.selectAllTeas();
    }

    /**
     * 新增茶叶
     * @param tea
     */
    @Override
    public void addTea(Tea tea) {
        teaMapper.addTea(tea);
    }

    /**
     * 更新茶叶
     * @param tea
     */
    @Override
    public void updateTea(Tea tea) {
        teaMapper.updateTea(tea);
    }

    /**
     * 删除茶叶
     * @param tid
     */
    @Override
    public void deleteTea(Integer tid) {
        teaMapper.deleteTea(tid);
    }

    /**
     * 根据ID查询茶叶
     * @param tid
     * @return
     */
    @Override
    public Tea selectTeaByID(Integer tid) {
        return teaMapper.selectTeaByID(tid);
    }

    /**
     * 根据名称查询茶叶
     * @param name
     * @return
     */
    @Override
    public List<Tea> selectTeasByName(String name) {
        return teaMapper.selectTeasByName(name);
    }


}
